﻿@model IEnumerable<AgileDashboard.Entities.WorkItem>


 <script id="rowTemplate" type="text/x-kendo-tmpl">
                <tr>
                    <td>
                        <a href="${ WorkItemUrl }" target="_blank" >${ Id }</a>
                    </td>
                    <td>
                        <span>${ Title }</span>
                    </td>
                    <td>
                        ${ WinningVote }
                    </td>
                    <td>
                        ${ VoteCount }
                    </td>
                    <td>
                        <a  href="/Vote/Create/?workItemId=${ Id }">Vote</a><br>
                        <a  href="/Home/Edit/${ Id }">Results</a>
                    </td>
                </tr>
            </script>

<script>



    $(document).ready(function () {
        $("#workItems").kendoGrid({
            dataSource: {
                type: "json",
                transport: {
                    read: "/PlanningPoker/WorkItems"
                },
                schema: {
                    model: {
                        fields: {
                            Id: { type: "string" },
                            Title: { type: "string" },
                            WinningVote: { type: "number" },
                            VoteCount: { type: "number" },
                            Action: { type: "string" }
                        }
                    }
                },
                pageSize: 50,
                serverPaging: false,
                serverFiltering: false,
                serverSorting: false
            },

            height: 800,
            filterable: true,
            sortable: true,
            pageable: true,


           
            columns: [{
                field: "Id",
                filterable: true,
                width: 40
            },{
                field: "Title",
                filterable: true,
                width: 220
            },{
                field: "WinningVote",
                filterable: true,
                width: 60
            },{
                field: "VoteCount",
                filterable: true,
                width: 60
            },{
                field: "Action",
                filterable: false,
                width: 70
            }
            
            
            ],
            rowTemplate: kendo.template($("#rowTemplate").html()),
            


        });
    });



</script>






<div>

<div id="workItems"></div>

</div>


